import styles from './index.less'
import { Anchor } from 'antd';
const { Link } = Anchor;
interface Iprops {
    toc: string
}
function handleAnchorClick(e: any) {
    e.preventDefault();
}
const catalogue = (props: Iprops) => {
    const { toc } = props
    const tocAr = toc ? JSON.parse(toc) : ''
    console.log('tocAr', tocAr);

    return <div className={styles.details_right_lower}>
        <div className='head'>目录</div>
        <main>
            <div  className="main">
                <Anchor onClick={handleAnchorClick} offsetTop={74} affix={false} style={{ height: "auto" }}>
                    {
                        tocAr ? tocAr.map((item: any) => {
                            {
                                return <Link href={`#${item.id}`} title={item.text} key={item.id} className={`floor${item.level}`}></Link>
                            }
                        }) : '暂无数据'
                    }
                </Anchor>
            </div>
        </main>
    </div>
}
export default catalogue